package com.by.auto;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "token.interceptor")
public class TokenInterceptorProperties {

    private final String[] DEFAULT_PATH_PATTERNS = {"/**"}; //默认拦截所有的请求
    private final String[] DEFAULT_EXCLUDE_PATH_PATTERNS = {"/login"}; //默认不拦截的请求
    String[] pathPatterns;//拦截的路径

    String[] excludePathPatterns;  //不拦截的路径


    public String[] getPathPatterns() {
        if (null == pathPatterns) {
            //提供默认值
            return DEFAULT_PATH_PATTERNS;
        }
        return pathPatterns;
    }

    public void setPathPatterns(String[] pathPatterns) {
        this.pathPatterns = pathPatterns;
    }

    public String[] getExcludePathPatterns() {
        if (null == excludePathPatterns) {
            return DEFAULT_EXCLUDE_PATH_PATTERNS;
        }
        return excludePathPatterns;
    }

    public void setExcludePathPatterns(String[] excludePathPatterns) {
        this.excludePathPatterns = excludePathPatterns;
    }
}
